<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> 
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ include file="../language.jsp" %>
<%

	if(session.getAttribute("password2")==null){
		response.sendRedirect( "login2.jsp?pageUrl=user/cp.jsp");
		return;
	}

%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title><fmt:message key="i18n.update"/><fmt:message key="i18n.loginPassword"/>-<fmt:message key="i18n.title"/> </title>
<link rel="shortcut icon" href="../index/favicon.png" />
<link href="../skin/skin1/css/subPage.css" rel="stylesheet">
<link rel="stylesheet" href="css/sub_page_main_style.css" />
</head>
<body style="background:#ede3d1;">
<!-- 主体内容 -->
<!-- main content -->
<div class="account">
	<div class="top"><fmt:message key="i18n.userCenter"/> &gt; <fmt:message key="i18n.updatePassword"/>
	 </div>
	<!-- <div class="left"></div> -->
	<div class="right">
    <form class="" id="cp1_form" action="registerUser!changePassword.action" method="post" >
      <input type="hidden" id="cp1_loginName" name="registerUserDTO.loginName" value="${session.loginName }" />
      <input type="hidden"  name="pageUrl" value="cp.jsp" />
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <th colspan="2"> <fmt:message key="i18n.loginPassword" /> </th>
        </tr>
        <tr>
          <td align="right"><fmt:message key="i18n.newPassword"/>：</td>
          <td><input class="srk100" type="password" name="registerUserDTO.password1" id="cp1_newPassword"  /></td>
        </tr>
        <tr>
          <td align="right"><fmt:message key="i18n.cofimPassword"/>：</td>
	      <td><input class="srk100" type="password" id="cp1_cofimPassword"  /></td>
        </tr>
        <tr>
          <th colspan="2"> <fmt:message key="i18n.tradePassword" /></th>
        </tr>
        <tr>
          <td align="right"><fmt:message key="i18n.newPassword"/>：</td>
	      <td><input class="srk100" type="password" name="registerUserDTO.password2" id="cp2_newPassword"  /></td>
        </tr>
        <tr>
          <td align="right"><fmt:message key="i18n.cofimPassword"/>：</td>
	      <td><input class="srk100" type="password" id="cp2_cofimPassword" /></td>
        </tr>
        <tr>
          <th colspan="2">
	        <span ><fmt:message key="i18n.getEmailValiCode" /></span>
	      </th>
        </tr>
        <%-- 
        <tr>
        	<td width="45%" align="right"><fmt:message key="i18n.ptype" />：</td>
			<td>
				<select class="srk100" name="registerUserDTO.passwordProblem">
					<jsp:include page="PwdProblem.jsp"></jsp:include>
				</select>
			</td>
        </tr>
        <tr>
        	<td align="right"><fmt:message key="i18n.answer" />：</td>
			<td><input class="srk100" id="cp_passwordAnswer" name="registerUserDTO.passwordAnswer" /></td>
        </tr> --%>
        <tr>
      			<td align="right"><fmt:message key="i18n.valicode"/>:</td>
      			<td>
      			<input class="easyui-validatebox srk100" id="cp_validCode" name="registerUserDTO.authCode"  />
      			<input type="hidden" value="${session.loginName }" id="cp_loginName" />
       			<input type="button" id="cp_loginName_button" value="<fmt:message key="i18n.getVerificationCode"/>" onclick="getVerificationCode('Email','UpdatePassword','#cp1_loginName','#cp_loginName_button')"> 
					<span style="color:red;" id="cp_loginName_show"></span>
      			</td>
        </tr>
        <tr>
        	<td style="border-right: 0xp;">&nbsp;</td>
			<td style="border-left: 0xp;">
				<c:if test="${not empty session.activationTime}">
     			<input type="button" class="btn cx_an1" onclick="changePassword1()" value="&nbsp;&nbsp;&nbsp;&nbsp;<fmt:message key="i18n.update"/>&nbsp;&nbsp;&nbsp;&nbsp;" />
     			</c:if>
			</td>
        </tr>
      </table>
      </form>
    </div>
</div>
<script src="js/jquery.min.js"></script>
<script src="../scripts/user/common.js"></script>
<script type="text/javascript">
	$(function(){
		document.onkeydown = function(evt){
			var evt = window.event?window.event:evt;
			if(evt.keyCode==13){
				changePassword1();
			}
		}
	});
	
	function changePassword1(){
		if($('#cp1_newPassword').val()==''){
			alert('Login password can not be empty(登录密码不能为空)!');
			$('#cp1_newPassword').focus();
			return false;
		}
		if($('#cp1_newPassword').val()!=$('#cp1_cofimPassword').val()){
			alert('Login password two times the input is not correct(登录密码两次输入不正确)!');
			$('#cp1_cofimPassword').focus();
			return false;
		}
		if($('#cp2_newPassword').val()==''){
			alert('Trading password can not be empty(交易密码不能为空)!');
			$('#cp2_newPassword').focus();
			return false;
		}
		if($('#cp2_newPassword').val()!=$('#cp2_cofimPassword').val()){
			alert('Trading password two times the input is not correct(交易密码两次输入不正确)!');
			$('#cp2_cofimPassword').focus();
			return false;
		}
		
		/* 
		if($('#cp_passwordAnswer').val()==''){
			alert('Secret security answer allowed is empty(密保答案不允许为空)!');
			$('#cp_passwordAnswer').focus();
			return false;
		} */
		if($('#cp_validCode').val()==''){
			alert('Verification code cannot be empty(验证码不能为空)!');
			$('#cp_validCode').focus();
			return false;
		}
		/* $.post('activationCode!authEmailCode.action','dto.type=邮件&dto.category=UpdatePassword&dto.activationCode='+$('#cp_validCode').val(),function(res){
			 if(!res){
				 alert('E-mail verification code is not correct(邮箱验证码不正确)!');
				 return false;
			 }else{
				 $('#cp1_form').submit();
			 }
		}); */
		$('#cp1_form').submit();
	}
</script>
</body>
</html>